/*
 * MySession.h
 *
 *  Created on: Mar 9, 2017
 *      Author: ectrs
 */

#ifndef SRC_MYSESSION_H_
#define SRC_MYSESSION_H_

#include <Poco/Util/TimerTask.h>
#include <Poco/UUID.h>
#include <Poco/Timestamp.h>

using namespace Poco;
using namespace Poco::Util;

class MySession
{
public:
	MySession();
	virtual ~MySession();

	bool login(std::string& userName, std::string& passwd);
	bool logout();

	const UUID& getUuid() const
	{
		return _uuid;
	}

	void setUuid(const UUID& uuid)
	{
		_uuid = uuid;
	}

	const std::string& getUserName() const
	{
		return _userName;
	}

	void setUserName(const std::string& userName)
	{
		_userName = userName;
	}

	void onTimer(TimerTask& task);
private:
	std::string _userName;
	Timestamp _loginTime;

	UUID _uuid;

	bool checkUserPasswd(std::string& userName, std::string& passwd);
};

#endif /* SRC_MYSESSION_H_ */
